<%
	name = "";

	String officer_code = "";
	String user_code_1 = "";
	String user_code_2 = "";
	String user_code_3 = "";
	String chain_merchant = "000000000";
	String hierarchy_no = "";
	String level = "";
	String servicing_rep = "";
	String sales_rep = "";
	String level_5 = "";
	String level_6 = "";
	String reference_no = "";
	
	if (m_case != null) {
		reference_no = m_case.getReferenceNo();
		if (reference_no == null) reference_no = "";
	}
	
	if(c_outlet != null) {
		name = c_outlet.getOutlet().getName();
		if(c_outlet.getOutlet().getOtherInfo().length() > 0) {
			JSONObject obj = (JSONObject) JSONValue.parse(c_outlet.getOutlet().getOtherInfo());

			officer_code = (obj.get("officer_code") == null) ? "" : obj.get("officer_code").toString();
			user_code_1 = (obj.get("user_code_1") == null) ? "" : obj.get("user_code_1").toString();
			user_code_1 = user_code_1.trim();
			user_code_2 = (obj.get("user_code_2") == null) ? "" : obj.get("user_code_2").toString();
			user_code_2 = user_code_2.trim();
			user_code_3 = (obj.get("user_code_3") == null) ? "" : obj.get("user_code_3").toString();
			user_code_3 = user_code_3.trim();
			chain_merchant = (obj.get("chain_merchant") == null) ? "" : obj.get("chain_merchant").toString();
			hierarchy_no = (obj.get("hierarchy_no") == null) ? "" : obj.get("hierarchy_no").toString();
			level = (obj.get("level") == null) ? "" : obj.get("level").toString();
			servicing_rep = (obj.get("servicing_rep") == null) ? "" : obj.get("servicing_rep").toString();
			sales_rep = (obj.get("sales_rep") == null) ? "" : obj.get("sales_rep").toString();
			level_5 = (obj.get("level_5") == null) ? "" : obj.get("level_5").toString();
			level_6 = (obj.get("level_6") == null) ? "" : obj.get("level_6").toString();
		}
	}
%>
<div class="row-fluid page">
	<div class="span12">

		<div class="section-header"><%= name %> - Other Information</div>
		<div class="row-fluid outlet-main-content">
			<div class="span12">
				<div class="form-horizontal other-main-content" style="padding:0px 30px">
					<div class="row-fluid">
						<div class="span12">
							<div class="control-group">
								<label class="control-label"><span class="must">*</span>Officer Code</label>
								<div class="controls">
									<input type="text" id="officer_code" value="<%= officer_code %>" />
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">User Code 1</label>
								<div class="controls">
									<input type="text" id="user_code_1" style="width:50px" value="<%= user_code_1 %>" />
									
									<label class="inline-block" style="margin-left:30px">User Code 2</label>
									<input type="text" id="user_code_2" style="width:50px" value="<%= user_code_2 %>" />
									
									<label class="inline-block" style="margin-left:30px">User Code 3</label>
									<input type="text" id="user_code_3" style="width:50px" value="<%= user_code_3 %>" />
								</div>
								
								
							</div>
							
							<div class="title">Amex Pos Hierarchy</div>
							
							<div class="control-group">
								<label class="control-label">Chain Merchant</label>
								<div class="controls">
									<input type="text" id="chain_merchant" value="<%= chain_merchant %>" />
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">Hierarchy No.</label>
								<div class="controls">
									<input type="text" id="hierarchy_no" value="<%= hierarchy_no %>" />
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">Level</label>
								<div class="controls">
									<select id="level">
									<%
										html = "<option value=\"0\">0 - Not in Hierarchy</option>"
											+ "<option value=\"9\">9 - Branch Level</option>"
											+ "<option value=\"8\">8 - Location Consolidated</option>"
											+ "<option value=\"7\">7 - District</option>"
											+ "<option value=\"6\">6 - State or Ownership Division</option>"
											+ "<option value=\"5\">5 - Head Office/Most Active Location</option>"
											+ "<option value=\"4\">4 - Statistical - Multi Industry Level</option>"
											+ "<option value=\"3\">3 - Statistical - Country Level</option>";
										
										html = html.replace("<option value=\"" + level + "\">", "<option value=\"" + level + "\" selected />");		
										out.println(html);
									%>
									</select> Level must take the format "9 - description"
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">Servicing Rep</label>
								<div class="controls">
									<select id="servicing_rep">
										<option value=""></option>
										<% 
										if (reference_no.indexOf("KH") < 0) {
											html = "<optgroup label=\"Merchant Business\">"
												+ "<option value=\"0400-x06\">0400-x06</option>"
												+ "<option value=\"0200-C01\">0200-C01</option>"
												+ "<option value=\"0200-C02\">0200-C02</option>"
												+ "<option value=\"0200-C03\">0200-C03</option>"
												+ "<option value=\"0200-C05\">0200-C05</option>"
												+ "<option value=\"0200-C08\">0200-C08</option>"
												+ "<option value=\"0200-A02\">0200-A02</option>"
												+ "<option value=\"0200-A05\">0200-A05</option>"
												+ "<option value=\"0400-K04\">0400-K04</option>"
												+ "<option value=\"0200-B01\">0200-B01</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"PENANG/PERLIS/KEDAH\">"
												+ "<option value=\"0200-P01\">0200-P01</option>"
												+ "<option value=\"0200-P02\">0200-P02</option>"
												+ "<option value=\"0200-P03\">0200-P03</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"PERAK\">"
												+ "<option value=\"0200-e01\">0200-e01</option>"
												+ "<option value=\"0200-e02\">0200-e02</option>"
												+ "<option value=\"0200-E03\">0200-E03</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"JOHOR\">"
												+ "<option value=\"0200-J01\">0200-J01</option>"
												+ "<option value=\"0200-J02\">0200-J02</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"MELAKA/NEGERI SEMBILAN\">"
												+ "<option value=\"0200-J01\">0200-J01</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"PAHANG/KELANTAN/TERENGGANU\">"
												+ "<option value=\"0200-D02\">0200-D02</option>"
												+ "<option value=\"0400-D03\">0400-D03</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"SABAH\">"
												+ "<option value=\"0200-S01\">0200-S01</option>"
												+ "<option value=\"0200-S02\">0200-S02</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"SARAWAK\">"
												+ "<option value=\"0200-R01\">0200-R01</option>"
												+ "<option value=\"0200-R02\">0200-R02</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"ESA\">"
												+ "<option value=\"0400-L11\">0400-L11</option>"
												+ "<option value=\"0400-L12\">0400-L12</option>"
												+ "<option value=\"0400-M11\">0400-M11</option>"
												+ "<option value=\"0400-M12\">0400-M12</option>"
												+ "<option value=\"0400-I11\">0400-I11</option>"
												+ "<option value=\"0400-I12\">0400-I12</option>"
												+ "<option value=\"0400-G11\">0400-G11</option>"
												+ "<option value=\"0400-G12\">0400-G12</option>"
												+ "</optgroup>";
												
										} else {
											// combodia
											html = ""
													+ "<option value=\"0300-K01\">0300-K01 Ros Sokhom</option>"
													+ "<option value=\"0300-K02\">0300-K02 Sok Mengleang</option>"
													+ "<option value=\"0300-K03\">0300-K03 Bou Bunrith</option>"
													+ "";
										}
											html = html.replace("<option value=\"" + servicing_rep + "\">", "<option value=\"" + servicing_rep + "\" selected />");		
											out.println(html);
										%>
									</select>
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">Sales Rep</label>
								<div class="controls">
									<select id="sales_rep">
										<option value=""></option>
										<%
										if (reference_no.indexOf("KH") < 0) {
											html = "<optgroup label=\"Merchant Business\">"
												+ "<option value=\"80560\">80560</option>"
												+ "<option value=\"24325\">24325</option>"
												+ "<option value=\"15854\">15854</option>"
												+ "<option value=\"79615\">79615</option>"
												+ "<option value=\"46628\">46628</option>"
												+ "<option value=\"77833\">77833</option>"
												+ "<option value=\"80162\">80162</option>"
												+ "<option value=\"27987\">27987</option>"
												+ "<option value=\"28052\">28052</option>"
												+ "<option value=\"9814\">9814</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"PENANG/PERLIS/KEDAH\">"
												+ "<option value=\"8534\">8534</option>"
												+ "<option value=\"8532\">8532</option>"
												+ "<option value=\"25613\">25613</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"PERAK\">"
												+ "<option value=\"980816\">980816</option>"
												+ "<option value=\"11722\">11722</option>"
												+ "<option value=\"19148\">19148</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"JOHOR\">"
												+ "<option value=\"19190\">19190</option>"
												+ "<option value=\"18619\">18619</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"MELAKA/NEGERI SEMBILAN\">"
												+ "<option value=\"983131\">983131</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"PAHANG/KELANTAN/TERENGGANU\">"
												+ "<option value=\"24164\">24164</option>"
												+ "<option value=\"11522\">11522</option>"
												+ "</optgroup>";
												
											html += "<optgroup label=\"SABAH\">"
												+ "<option value=\"10144\">10144</option>"
												+ "<option value=\"26516\">26516</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"SARAWAK\">"
												+ "<option value=\"14385\">14385</option>"
												+ "<option value=\"10442\">10442</option>"
												+ "</optgroup>";
											
											html += "<optgroup label=\"ESA\">"
												+ "<option value=\"L1023477\">L1023477</option>"
												+ "<option value=\"M1023477\">M1023477</option>"
												+ "<option value=\"I1023477\">I1023477</option>"
												+ "<option value=\"G1023477\">G1023477</option>"
												+ "</optgroup>";
											
										} else {
											// combodia
											html = ""
													+ "<option value=\"00098940\">Bou Bunrith</option>"
													+ "<option value=\"00120571\">Ev Sereipheakny</option>"
													+ "<option value=\"00097551\">Ou Chheng Im</option>"
													+ "<option value=\"00089517\">Chin Sao</option>"
													+ "";	
										}

											html = html.replace("<option value=\"" + sales_rep + "\">", "<option value=\"" + sales_rep + "\" selected />");		
											out.println(html);
										%>
									</select>
								</div>
							</div>
							
							<div class="title">Amex Ezypay Hierarchy</div>
							
							<div class="control-group">
								<label class="control-label">Level 5</label>
								<div class="controls">
									<input type="text" id="level_5" value="<%= level_5 %>" />
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label">Level 6</label>
								<div class="controls">
									<input type="text" id="level_6" value="<%= level_6 %>" />
								</div>
							</div>
						</div>
				
					</div>
				</div>
			</div>
		</div>

	</div>
</div>